<include file="Public:header" />

<div class="tools"> 
<div class="del"><span><a href="javascript:void(0);" onclick="del();">删除</a></span></div>
</div>
<div class="content">
<div class="page">{$page}</div>
<!-----------------------------------------内容开始--------------------------------------------------->
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabBox">
<tr class="tabTitleMain">
    <td width="5%" align="center"><input type="checkbox" id="checkbox_handle" onclick="checkAll(this)" value="0"></td>
    <td width="10%" align="center">评论内容</td>
    <td width="10%" align="center">评论对象</td>
    <td width="6%" align="center">发表用户</td>
    <td width="6%" align="center">用户组</td>
    <td width="6%" align="center">评论时间</td>
    <td width="6%" align="center">操作</td>
</tr>

<volist name='data' id='l'>
	<tr class="tabTextMain" id="From_1" onmouseout="this.style.background='#FFFFFF';" onmouseover="this.style.background='#fbf435';">
		<td align="center"><input type="checkbox" name="checkbox" id="checkbox2" onclick="checkon(this)" value="{$l.id}"></td>
		<td align="center">{$l.content}</td>
		<td align="center">{$l.artname}</td>
		<td align="center">{$l.username}</td>
		<td align="center">{$l.usergrp}</td>
		<td align="center">{$l.ctime|date='Y-m-d H:i:s',###}</td>
		<td align="center">
			<a href="{:U('Admin/editshop_pl',array('id'=>$l['id']))}">修改</a>
			|
			<php>
			if($l['state']==1){
			</php>
			  <a href="javascript:;" onclick="del({$l.id});">删除</a>
			<php>
			}else if($l['state']==3){
			</php>
			  <a href="javascript:;" onclick="hui({$l.id});">恢复</a>
			<php>
			}
			</php>
		</td>
	</tr>
	<volist name="l.hf" id="hf">
		<tr class="tabTextMain" id="From_1" bgcolor="#dddddd" onmouseout="this.style.background='#dddddd';" onmouseover="this.style.background='#cccccc';">
			<td align="center"><input type="checkbox" name="checkbox" id="checkbox2" onclick="checkon(this)" value="{$hf.id}"></td>
			<td align="center">{$hf.content}</td>
			<td align="center">{$hf.duixiang_nc}</td>
			<td align="center">{$hf.zuozhe_nc}</td>
			<td align="center">{$hf.usergrp}</td>
			<td align="center">{$hf.ctime|date='Y-m-d H:i:s',###}</td>
			<td align="center">
				<a href="{:U('Admin/editshop_pl',array('id'=>$hf['id']))}">修改</a>
				|
				<php>
				if($hf['state']==1){
				</php>
				  <a href="javascript:;" onclick="del({$hf.id});">删除</a>
				<php>
				}else if($hf['state']==3){
				</php>
				  <a href="javascript:;" onclick="hui({$hf.id});">恢复</a>
				<php>
				}
				</php>
			</td>
		</tr>
	</volist>
	
</volist>
</table> 
<div class="page">{$page}</div>
<!-----------------------------------------内容结束--------------------------------------------------->
</div>
<script type="text/javascript">   
  function checkAll(o){
        if( o.checked == true ){
            $('input[name="checkbox"]').attr('checked','true');
        }else{
            $('input[name="checkbox"]').removeAttr('checked');
        }
    }
	
	function del(bid){
        bid = bid ? bid : getChecked();
        bid = bid.toString();
        if(bid == ''){
		    ui.error('您没有选择任何选项！');
        	return false;
        }

		$.post("{:U('Admin/delshop_pl')}", {ids:bid}, function(v){
			if( v == 1 ){
                bid = bid.split(',');
                $.each(bid, function(i,n){
                    $('#l_'+n).remove();
                });
                ui.success('删除成功！');
				location.reload();
			}else{
				ui.error('删除失败！');
			}
		});
	}
	function hui(bid){
        bid = bid ? bid : getChecked();
        bid = bid.toString();
        if(bid == ''){
		    ui.error('您没有选择任何选项！');
        	return false;
        }

		$.post("{:U('Admin/huishop_pl')}", {ids:bid}, function(v){
			if( v == 1 ){
                bid = bid.split(',');
                $.each(bid, function(i,n){
                    $('#l_'+n).remove();
                });
                ui.success('恢复成功！');
				location.reload();
			}else{
				ui.error('恢复失败！');
			}
		});
	}

    //获取已选择用户的ID数组
    function getChecked() {
        var gids = new Array();
        $.each($('input:checked'), function(i, n){
            gids.push( $(n).val() );
        });
        return gids;
    }

</script>

    

<include file="Public:footer" />
